﻿<UserControl x:Class="VsiBuilderControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" xmlns:my="clr-namespace:AlessandroDelSole.VsiBuilder2010"
             xmlns:vsi="clr-namespace:DelSole.VsiBuilder2010;assembly=DelSole.VsiBuilder2010"
             d:DesignHeight="400" d:DesignWidth="600">
    <UserControl.Resources>
        <CollectionViewSource x:Key="ItemFileViewSource" d:DesignSource="{d:DesignInstance vsi:ItemFile, CreateList=True}" />
    </UserControl.Resources>
    
    <Grid DataContext="{StaticResource ItemFileViewSource}">
        <Grid.RowDefinitions>
            <RowDefinition Height="36" />
            <RowDefinition  />
        </Grid.RowDefinitions>


        <DataGrid AutoGenerateColumns="False" Grid.Row="1" AlternatingRowBackground="#BCC7D8" CellStyle="{DynamicResource CellStyle}" Visibility="Visible"
                  EnableRowVirtualization="True" ItemsSource="{Binding}" Name="ItemFileDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected">
            <DataGrid.Resources>
            <Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
                <Style.Triggers>

                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Background">
                            <Setter.Value>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="#FFFBEF" Offset="0"/>
                                    <GradientStop Color="#FFF7DF" Offset="0.5"/>
                                    <GradientStop Color="#FFECB5" Offset="1"/>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="Foreground" Value="Black"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
</DataGrid.Resources>

            <DataGrid.Columns>
                <DataGridTextColumn x:Name="FileNameColumn" Binding="{Binding Path=FileName}" Header="File Name" Width="SizeToCells" />
                <DataGridTextColumn x:Name="FileContentTypeColumn" Binding="{Binding Path=FileContentType}" Header="File Content Type" Width="SizeToHeader" />
                <DataGridTextColumn x:Name="FullPathColumn" Binding="{Binding Path=FullPath}" Header="Full Path" Width="150" />
            </DataGrid.Columns>
        </DataGrid>

        <StackPanel Orientation="Horizontal" Grid.Row="0" Background="#BCC7D8" Name="MainStackPanel" Height="30">
            <Button Name="AddContentsButton" Click="AddContentsButton_Click" ToolTip="Add contents" Width="24" Height="24" Margin="5" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/openHS.png" />
                </Button.Content>                   
            </Button>
            <Button Name="OpenContentsListButton" Click="OpenContentsListButton_Click" ToolTip="Import contents from disk" Width="24" Height="24" Margin="5" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/OpenSelectedItemHS.png" />
                </Button.Content>
            </Button>

            <Button Name="SaveContentsListButton" Click="SaveContentsListButton_Click" ToolTip="Save list to disk" Width="24" Height="24" 
                    Margin="5" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/saveHS.png" />
                </Button.Content>
            </Button>
            <Button ToolTip="Remove the selected item" Padding="0" Background="Transparent" BorderBrush="Transparent" Click="RemoveSelectedButton_Click" BorderThickness="0" Name="RemoveSelectedButton" Margin="5" Width="24" Height="24">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/DeleteHS.png" />
                </Button.Content>
            </Button>
            <Button ToolTip="Clear list" Padding="0" Background="Transparent" BorderBrush="Transparent" Click="EraseContentsButton_Click" BorderThickness="0" Name="EraseContentsButton" Margin="5" Width="24" Height="24">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/DeleteFolderHS.png" />
                </Button.Content>
            </Button>
            <Rectangle StrokeThickness="1" Height="24" Stroke="Gray" />
            <CheckBox Name="AddEulaCheck" Click="AddEulaCheck_Click" Content="Add EULA" Margin="5" Height="24"/>
            <Button Name="AddEulaButton" ToolTip="Import EULA from text file" Click="AddEulaButton_Click" Width="24" Height="24" Margin="5" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/TextboxHS.png" />
                </Button.Content>
            </Button>
            <Button Name="CreatePackageButton" ToolTip="Create .Vsi Package" Click="CreatePackageButton_Click" Margin="5" Width="24" Height="24" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/Build.png" />
                </Button.Content>
             </Button>
            <Button Name="UninstallButton" ToolTip="Uninstall contents for Visual Studio" Click="UninstallButton_Click" Margin="5" Width="24" Height="24" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/Uninstall_Icon.png" Name="Image1" />
                </Button.Content>
            </Button>
            <Button Name="DigitalSignatureButton" ToolTip="Apply a digital signature to .Vsi packages" Click="DigitalSignatureButton_Click" Width="24" Height="24" Margin="5" Padding="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/157_GetPermission_16x16_72.png" />
                </Button.Content>
            </Button>
            <Button Margin="5" Padding="0" Background="Transparent" ToolTip="Help" BorderBrush="Transparent" BorderThickness="0" Name="HelpButton" Width="24" Height="24" Click="HelpButton_Click" >
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/Book_openHS.png" />
                </Button.Content>
            </Button>
        </StackPanel>

        <StackPanel Orientation="Horizontal" Height="30" Grid.Row="0"  Name="UninstallStackPanel" Visibility="Hidden" Background="#BCC7D8">
                <Button Padding="0" Background="Transparent" ToolTip="Uninstall the selected contents" 
                        BorderBrush="Transparent" Click="UninstallSelectedButton_Click" BorderThickness="0" Name="UninstallSelectedButton" Margin="5" Width="24" Height="24">
                    <Button.Content>
                        <Image Source="/VsiBuilder2010;component/Images/DeleteHS.png" />
                    </Button.Content>
                </Button>
            <Button ToolTip="Return to the main screen" Width="24" Height="24" Margin="5" Name="ReturnToMainGridButton" Padding="0" Background="Transparent" BorderThickness="0">
                <Button.Content>
                    <Image Source="/VsiBuilder2010;component/Images/NavBack.png" />
                </Button.Content>
            </Button>
        </StackPanel>

        <DataGrid AutoGenerateColumns="False" Grid.Row="1" AlternatingRowBackground="#BCC7D8" CellStyle="{DynamicResource CellStyle}" IsReadOnly="True"
                  EnableRowVirtualization="True" ItemsSource="{Binding}" Name="UninstallDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" Visibility="Hidden">
                <DataGrid.Resources>
                    <Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
                        <Style.Triggers>

                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Background">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Color="#FFFBEF" Offset="0"/>
                                            <GradientStop Color="#FFF7DF" Offset="0.5"/>
                                            <GradientStop Color="#FFECB5" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Foreground" Value="Black"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </DataGrid.Resources>

                <DataGrid.Columns>
                    <DataGridTextColumn x:Name="NameColumn" Binding="{Binding Path=Name}" Header="Name" Width="150" />
                    <DataGridTextColumn x:Name="TypeColumn" Binding="{Binding Path=Type}" Header="Type" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="DescriptionColumn" Binding="{Binding Path=Description}" Header="Description" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="InstalledPathColumn" Binding="{Binding Path=InstalledPath}" Header="InstalledPath" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="TimeStampColumn" Binding="{Binding Path=TimeStamp}" Header="TimeStamp" Width="SizeToHeader" />
                </DataGrid.Columns>
            </DataGrid>

    </Grid>
</UserControl>
